Answer:

JTextField.getText()

User Input

Here is the program so far. To finish it fill in the remaining blanks.

  1. Use the getText() method to get the user's input.
  2. Use the parseInt() static method of the wrapper class Integer to convert the input to an int.
  3. Use the setText() method to convert and display the result in outCel.
import java.awt.*; 
import java.awt.event.*;
   
public class FahrConvert extends JFrame implements ActionListener
{
  JLabel title    = new JLabel("Convert Fahrenheit to Celsius");
  JLabel inLabel  = new JLabel("Fahrenheit    ");
  JLabel outLabel = new JLabel("Celsius ");
   
  JTextField inFahr = new JTextField( 7 );
  JTextField outCel = new JTextField( 7 );
    
  int fahrTemp ;
  int celsTemp ;
   
   . . . .
   
  public void actionPerformed( ActionEvent evt)  
  {
    String userIn = ;
    fahrTemp = ;
    convert() ;
  
    ( celsTemp+" " );
    repaint();                  
  }
   . . . .  
}

QUESTION 6:

Fill in the blanks.